package com.samphanie.auiu

import android.content.Context
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import com.alibaba.android.arouter.launcher.ARouter
import com.samphanie.auiu.pub_mod.model.UserProfile

/**
 * @author Dries
 **/
object LoginServiceProvider {

    private val iLoginService = ARouter.getInstance().build("/login/service").navigation() as? ILoginService

    fun login(context: Context?, observer: Observer<Boolean>) {
        iLoginService?.login(context, observer)
    }

    fun isLogin(): Boolean {
        return iLoginService?.isLogin() == true
    }

    fun getUserProfile(lifecycleOwner: LifecycleOwner?, observer: Observer<UserProfile?>, onlyCache: Boolean) {
        iLoginService?.getUserProfile(lifecycleOwner, observer, onlyCache)
    }

}